package ControlLayer;
import java.util.ArrayList;
import ModelLayer.DvdContainer;
import ModelLayer.Dvd;
import ModelLayer.DvdCopy;
//model layer package has to be imported
/**
 * Controller class for the DVD collection
 * 
 * @author (kbh) 
 * @version (2005.03.31)
 * @revised version English (Ab)
 * (FEN): 2006.03.21: Some changes to the architecture in order to assure layering
 *                    and loose coupling
 */
public class DVDCtr
{
    private DvdContainer dCon;
    private static DVDCtr instance;

    /**
     * Constructor for objects of class DVDCtr
     */
    public DVDCtr()
    {
        dCon = dCon.getInstance();
    }
    
    private static DVDCtr getInstance()
    {
        if(instance == null)
        {
            instance = new DVDCtr();
        }
            return instance;
    }
    
    public Dvd findDVD(String id)
    {
        return dCon.findDvd(id);
    }
    
    //Dummy implementation: more parameters are probaly to added
    public void createDVD(String genre, String title, String description, String id)
    {      
          if(instance == null)
          {
              instance = new DVDCtr();
              dCon.addDvd(genre, title, description, id);
          }
          else
          {
          dCon.addDvd(genre, title, description, id);
          }
    }
    
    public void deleteDVD(String id)
    {
        dCon.deleteDvd(id);
    }
    
    public void updateDescription(String id, String newDescription)
    {
        dCon.setDescription(id, newDescription);
    }
    
     public void updateTitle(String id, String newTitle)
    {
        dCon.setTitle(id, newTitle);
    }
    
    public void updateGenre(String id, String newGenre)
    {
        dCon.setGenre(id, newGenre);
    }
    
    public DvdCopy findCopy(String id, String copyNr)
    {
        return dCon.findCopy(id, copyNr);
    }
    
    public void createCopy(String id, String copyNr, String year, double price)
    {
        dCon.createCopy(id, copyNr, year, price);
    }
    
    public void printDvdInfo(String id)
    {
        dCon.printDvdInformation(id);
    }
    
    public void printAllDvds()
    {
        dCon.printAllDvds();
    }

    
    
    
    
    
    
    
    
    
    
    
    
}
